package com.learnyou.server.xingzuo.controller.app;

import com.learnyou.server.xingzuo.dto.paramDTO.wechat.WechatEncryptParamDTO;
import com.learnyou.server.xingzuo.dto.paramDTO.wechat.third.WechatThirdAuthCodeDTO;
import com.learnyou.server.xingzuo.dto.paramDTO.wechat.third.WechatThirdPrivateAuthCodeDTO;
import io.swagger.annotations.Api;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@RequestMapping("/wechat/event/third")
@Api(tags = "WechatThirdApiResource")
public interface WechatThirdApiResource {

    @PostMapping(value = "/auth", consumes = {MediaType.TEXT_XML_VALUE, MediaType.APPLICATION_XML_VALUE})
    String authEvent(WechatEncryptParamDTO params, @RequestBody String encryptData);

    /**
     * 第三方平台授权回调
     * @param params
     * @param response
     */
    @GetMapping("/auth/callback")
    void authCallback(WechatThirdAuthCodeDTO params, HttpServletResponse response);

    /**
     * 第三方平台普通用户个人授权回调(获得授权code)
     */
    @GetMapping("/auth/private/callback")
    void privateAuthCallbackOfCode(WechatThirdPrivateAuthCodeDTO privateAuthCodeDTO, HttpServletResponse response) throws IOException;


}
